library(kernlab)
library(caret)
library(ROCR)

setwd("D:/ClassificationR")

#membaca data training & data testing
data.training = read.csv("titanic2class.train.1.csv")
data.test = read.csv("titanic2class.test.1.csv")

#membuat model 
model = ksvm(Survived~., data.training)

#melakukan prediksi
predict_result = predict(model, data.test[,-4])

#menghitung kinerja
roc.prediction = prediction(as.numeric(as.factor(predict_result)), as.numeric(as.factor(data.test[,4])))

roc.tpr.fpr = performance(roc.prediction,"tpr","fpr")
roc.auc = performance(roc.prediction,"auc")
plot(roc.tpr.fpr, col="red",lty=3)
abline(a=0, b= 1)

#menampilkan hasil perhitungan kinerja dan luas AUC
print(paste("Luas AUC:", roc.auc@y.values))
